<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>海量点</title>
    <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
    <style>
        html, body, #container {
            height: 100%;
            width: 100%;
        }

        .input-card .btn {
            margin-right: 1.2rem;
            width: 9rem;
        }

        .input-card .btn:last-child {
            margin-right: 0;
        }
        .input-card{
            width:400px;
            left:0rem;
            bottom: 0rem;
            z-index: 10000;
        }
        .amap-logo {
    display: none !important;
    visibility: hidden !important;
}
.amap-copyright {
    display: none !important;
    visibility: hidden !important;
}
    </style>
</head>
<body>
<div id="container" class="map" tabindex="0"></div>
<div class="input-card">
    <h4>业务点显示切换</h4>
    <div class="input-item">
        <input type="button" class="btn" value="只显示基站" onclick='setStyle(0)'/>
        <input type="button" class="btn" value="显示重点报警区域" onclick='setStyle(1)'/>
        <input type="button" class="btn" value="切换到岳阳场景" onclick='goto3D(1)'/>
    </div>
</div>
<script type="text/javascript" src='https://a.amap.com/jsapi_demos/static/citys.js'></script>

<script src="https://webapi.amap.com/maps?v=2.1Beta&key=274f2563175c1dbb2a7212dfe2444951"></script>
<script type="text/javascript">
   var map = new AMap.Map('container', {
        zoom: 4,
        center: [102.342785, 35.312316],
        showIndoorMap: false,
        terrain: true, //开启地形图
        viewMode: '3D',
        pitch: 50
    //    layers: [
    //         // 卫星
    //         new AMap.TileLayer.Satellite(),
    //         // 路网
    //         new AMap.TileLayer.RoadNet()
    //     ],
    });

    // JSAPI 2.0 支持显示设置 zIndex, zIndex 越大约靠前，默认按顺序排列
    var style = [{
        url: 'https://webapi.amap.com/images/mass/mass0.png',
        anchor: new AMap.Pixel(6, 6),
        size: new AMap.Size(11, 11),
        zIndex: 3,
    }, {
        url: 'https://webapi.amap.com/images/mass/mass1.png',
        anchor: new AMap.Pixel(4, 4),
        size: new AMap.Size(7, 7),
        zIndex: 2,
    }, {
        url: 'https://webapi.amap.com/images/mass/mass2.png',
        anchor: new AMap.Pixel(3, 3),
        size: new AMap.Size(5, 5),
        zIndex: 1,
    }
    ];

    var mass = new AMap.MassMarks(citys, {
        opacity: 0.8,
        zIndex: 111,
        cursor: 'pointer',
        style: style
    });

    var marker = new AMap.Marker({content: ' ', map: map});

    mass.on('mouseover', function (e) {
        marker.setPosition(e.data.lnglat);
        if(e.data.lnglat[0] == '113.132855'){
            marker.setLabel({content: "这里是岳阳" })
        }else{
            marker.setLabel({content: "基站:"+e.data.lnglat + "" })
        }
      
    });
    mass.on('click', function (e) {
        //marker.setPosition(e.data.lnglat);
        if(e.data.lnglat[0] <= '112.9882279'){
            console.log(map)
            map.setZoomAndCenter( 18, [113.1205021, 29.3667323] );
        }else{
            //marker.setLabel({content: "基站:"+e.data.lnglat + "" })
        }
      
    });
    mass.setMap(map);

    function setStyle(multiIcon) {
        if (multiIcon) {
            mass.setStyle(style);
        } else {
            mass.setStyle(style[2]);
        }
    }
    function goto3D(){
        window.location.href="http://www.baidu.com"
    }
</script>
</body>
</html>